import 'reflect-metadata';
import { container } from './infrastructure/ioc/container';
import { TYPES } from './infrastructure/ioc/types';
import { WsServer } from './transport/websocket/ws.server';
import { DataSource } from 'typeorm';
import { LoggerService } from './infrastructure/logging/logger.service';

async function bootstrap() {
  const dataSource = container.get<DataSource>(TYPES.DataSource);
  await dataSource.initialize();

  const logger = container.get<LoggerService>(TYPES.LoggerService);
  logger.info('Database initialized');

  container.get<WsServer>(TYPES.WsServer);
}

bootstrap().catch((error) => {
  console.error('Bootstrap error:', error);
});